home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 July / macformat-092.iso / MacFormat 92 CD / Shareware Plus / Utilities / FolderSynchronizer 1.8.9 / FoldersSynchronizer / FoldersSynchronizer.9 / AllScripts_11_AppleEventMy.ls < prev    next >
Encoding:
Text File  |  2000-05-10  |  3.5 KB  |  116 lines

  1. on GliAppleEvent____________________
  2. end
  3.  
  4. on InitAppleScript
  5.   global gASCheckBoxNameList, gASCheckBoxSpriteList, gASRadioButtonNameList, gASRadioButtonSpriteList
  6.   set gASCheckBoxNameList to ["BeepWhenDone", "SaveLogFile", "RememberFolders", "ExactBackUp", "Invisible", "UnlockFile"]
  7.   set gASCheckBoxSpriteList to [11, 14, 5, 17, 20, 23]
  8.   set gASRadioButtonNameList to ["OnErrorDo"]
  9.   set gASRadioButtonSpriteList to [28]
  10. end
  11.  
  12. on ASBackUp Sorgente, Destinazione
  13.   global gOneDirection
  14.   set gOneDirection to 1
  15.   DomyAppleEvent(Sorgente, Destinazione)
  16. end
  17.  
  18. on ASSynchronize Sorgente, Destinazione
  19.   global gOneDirection, gBigTextLog
  20.   set gOneDirection to 0
  21.   DomyAppleEvent(Sorgente, Destinazione)
  22. end
  23.  
  24. on DomyAppleEvent Sorgente, Destinazione
  25.   global gSourceFolder, gDestFolder, gOneDirection, gBigTextLog, gSaveLogFile
  26.   if not voidp(Sorgente) and (Sorgente <> EMPTY) then
  27.     set gSourceFolder to Sorgente
  28.   end if
  29.   if not voidp(Destinazione) and (Destinazione <> EMPTY) then
  30.     set gDestFolder to Destinazione
  31.   end if
  32.   put AccorciaNome(gSourceFolder) into field "fSourceFolder"
  33.   put AccorciaNome(gDestFolder) into field "fDestFolder"
  34.   CheckOneDirection()
  35.   CheckSyncButton()
  36.   GoLista()
  37.   set err to DoSynchronize()
  38.   if err then
  39.     set gBigTextLog to field "P4" && "from:" & RETURN & gSourceFolder && "to:" & RETURN & gDestFolder & RETURN & RETURN
  40.     put "Start at:" && the long date && "-" && the long time & RETURN & "--" & RETURN after gBigTextLog
  41.     beep(1)
  42.     case err of
  43.       1:
  44.         set message to "Source Folder not defined. Calling by AppleScript stopped."
  45.       2:
  46.         set message to "Destination Folder not defined. Calling by AppleScript stopped."
  47.       3:
  48.         set message to "Source Folder not found. Calling by AppleScript stopped."
  49.       4:
  50.         set message to "Destination Folder not found. Calling by AppleScript stopped."
  51.     end case
  52.     put message & RETURN & "No tasks done." after gBigTextLog
  53.     if gSaveLogFile then
  54.       SaveLogFile()
  55.     end if
  56.     set gBigTextLog to EMPTY
  57.   end if
  58. end
  59.  
  60. on ASSetCheckBox checkName, checkValue
  61.   global gASCheckBoxNameList, gASCheckBoxSpriteList, gBeepWhenDone, gSaveLogFile, gRememberFolders, gDestructive, gInvisible, gUnlockFile
  62.   if voidp(checkName) or (checkName = EMPTY) then
  63.     return -1
  64.   end if
  65.   set myPos to getPos(gASCheckBoxNameList, checkName)
  66.   if myPos = 0 then
  67.     return -1
  68.   end if
  69.   if voidp(checkValue) or ((checkValue <> 0) and (checkValue <> 1)) then
  70.     return -2
  71.   end if
  72.   case myPos of
  73.     1:
  74.       set gBeepWhenDone to checkValue
  75.     2:
  76.       set gSaveLogFile to checkValue
  77.     3:
  78.       set gRememberFolders to checkValue
  79.     4:
  80.       set gDestructive to checkValue
  81.     5:
  82.       set gInvisible to checkValue
  83.     6:
  84.       set gUnlockFile to checkValue
  85.   end case
  86.   if the frameLabel = "Info" then
  87.     set mySprite to getAt(gASCheckBoxSpriteList, myPos)
  88.     set the member of sprite mySprite to "BtnUpCHK" & checkValue
  89.     updateStage()
  90.   end if
  91.   return 0
  92. end
  93.  
  94. on ASSetRadioButton checkName, checkValue
  95.   global gASRadioButtonNameList, gASRadioButtonSpriteList, gOnErrorDo
  96.   if voidp(checkName) or (checkName = EMPTY) then
  97.     return -1
  98.   end if
  99.   set myPos to getPos(gASRadioButtonNameList, checkName)
  100.   if myPos = 0 then
  101.     return -1
  102.   end if
  103.   if voidp(checkValue) or ((checkValue <> 0) and (checkValue <> 1)) then
  104.     return -2
  105.   end if
  106.   case myPos of
  107.     1:
  108.       set gOnErrorDo to checkValue
  109.   end case
  110.   if the frameLabel = "Info" then
  111.     SetRadiogOnErrorDo()
  112.     updateStage()
  113.   end if
  114.   return 0
  115. end
  116.